using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Xpo;

using Component;
namespace Component
{
    public class ContentManagementDB : Base
    {

        /// <summary>
        /// public static XPCollection<ContentManagement> GetAll()
        /// </summary>
        /// <returns>XPCollection<ContentManagement></returns>
        public static XPCollection<ContentManagement> GetAll(bool admin)
        {
            XPCollection<ContentManagement> _xpContentManagement = new XPCollection<ContentManagement>(KetNoiCSDL.session);
            _xpContentManagement.Filter = DevExpress.Data.Filtering.CriteriaOperator.Parse("Active=true ");
            _xpContentManagement.Sorting = SetupSort(ColumContentManagement._Priority,true);
            return _xpContentManagement;
        }
        /// <summary>
        /// public static ContentManagement GetObjectByid(int id)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ContentManagement GetObjectByid(int id,bool admin)
        {
            XPCollection<ContentManagement> _xpContentManagement = new XPCollection<ContentManagement>(KetNoiCSDL.session);
            _xpContentManagement.Filter = FilterAll(admin);
            return _xpContentManagement.Lookup(id);
        }
    }
}
